import { ajax } from "@/utils/ajax";

// 黑名单
export interface BlackItem {
    id: number;
    studentId: number;
    studentNumber?: string;
    name: string;
    sex: number; // 0:女, 1:男
    age: number;
    grade: string;
    department: string;
    major: string;
    reason: string;
    createTime: string;
}

// 分页
export interface BlackPaginationResponse {
    list: BlackItem[];
    total: number;
    pages: number;
}

// 获取黑名单列表
export const getBlackList = (params:{
    pageNum?: number;
    pageSize?: number;

})=> {
    return ajax.get('/black/getList', { params });
}

// 解除拉黑
export const removeFromBlacklist = (studentId: number) => {
    return ajax.delete('/black/delete', {
        params: { studentId }
    });
};

// 获取院系列表
export const getDepartmentList = () => {
    return ajax.get<ApiResponse<DataModel[]>>("/data/getList");
};

// 根据院系获取专业列表
export const getMajorListByDepartment = (department: string) => {
    return ajax.get<ApiResponse<DataModel[]>>("/data/getByID", {
        params: { department }
    });
};

// 搜索学生
export const searchStudents = (data: any) => {

    const { pageNum, pageSize, ...searchParams } = data;
    return ajax.post("/black/Search", searchParams, {
        params: {
            pageNum,
            pageSize
        }
    });
};


